Skip to content

fix(files): use exact batch ETAs for P90 lane load accounting - #218

Merged
NityamPareek merged 1 commit into
mainfrom
fix/p90-lane-load-accounting
Nov 13, 2026
Merged

NityamPareek merged 1 commit into
mainfrom
fix/p90-lane-load-accounting

Conversation

@NityamPareek

@NityamPareek NityamPareek commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

In a full Shallow Scan of the googlellc914 tenant (1,018 sites, 5 lanes), Batch 10 (102 small sites, 6.2h) was placed after Batch 1 in the longest lane. That pushed the total ETA to 4d 21h (116.9h), while other lanes had ~8–16h of spare capacity.

Root cause

Lane load was measured one way during assignment and another way for display:

  • During greedy assignment: lane load = sum of pre-merge P90 group ETAs + per-site ETAs.
  • For display: a lane's P90 groups are merged into one batch, and its ETA is computed on combined totals.

Batch ETA is max(files ÷ QPS, size ÷ throughput), which is not additive. When count-bound and size-bound P90 sites are merged, their costs overlap, so the merged ETA is much lower than the sum. On this run the P90 batches in lanes 2–5 were overstated by 7.8 / 16.4 / 16.4 / 13.4h. Lane 1 (Batch 1, 110.7h) therefore looked like the least-loaded lane and received the leftover sites.

Fix

plan_p90_lanes now tracks each lane exactly as its batches will finally be:

  • Running totals (files, size, encrypted files, encrypted size) for the lane's merged P90 batch and its open regular chunk.
  • Lane load = sum of eta_from_totals(...) over those batches, using the same ETA function as the displayed batch ETAs.
  • Efficient: each placement re-evaluates one batch ETA and updates one cached lane load, so cost stays O(sites × lanes).
  • Unchanged: batch structure (P90 merging, 5,000-site chunks, in-lane order) and the least-loaded-lane rule. LanePlan now also exposes lane_loads.
  • calculate_migration_batches passes per-site totals and the display ETA function.
During greedy lane assignment the planner tracked lane load as the sum of pre-merge P90 group ETAs and per-site ETAs, while displayed lane ETAs use merged/chunked batch ETAs. Batch ETA is max(files/QPS, size/throughput), which is not additive: merging count-bound and size-bound P90 sites overlaps them. Lanes with mixed P90 batches were overstated (8-16h on the googlellc914 run), so leftover sites landed on the already-longest lane (Batch 10 after Batch 1), raising the total ETA from ~110.7h to 116.9h.

- plan_p90_lanes now keeps running totals per batch (merged P90 batch + open regular chunk) and evaluates lane load with the same eta_from_totals used for display. Each placement re-evaluates one batch ETA, so cost stays O(sites x lanes) (~0.3s for 200k sites in the planner, ~2.7s end to end).
- Batch structure (merging, 5,000-site chunks, in-lane order) and the least-loaded-lane rule are unchanged. LanePlan exposes final lane_loads.
- calculate_migration_batches passes per-site totals and the display ETA function.
- Tests: exactness vs recomputed batch ETAs, regression for the misplacement, linear ETA-evaluation count, end-to-end with the real ETA formula. README note on lane load.
@NityamPareek
NityamPareek merged commit 62c2aa5 into main Nov 13, 2026
10 checks passed
@NityamPareek
NityamPareek deleted the fix/p90-lane-load-accounting branch November 13, 2026 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant